#ifndef _GDT_HPP_
#define _GDT_HPP_
#define GDT_SIZE 128
#define IDT_SIZE 256

STRUCT(descriptor)
{
  void          init(type::u32 base, type::u32 limit, type::u16 attribute);
  type::u16	limit_low;		
  type::u16	base_low;		
  type::u8	base_mid;		
  type::u8	attr1;			
  type::u8	limit_high_attr2;	
  type::u8	base_high;		
};

STRUCT(gate)
{
  void          init(type::fptr handler,type::u32 privilege);  
  type::u16	offset_low;
  type::u16	selector;	
  type::u8	dcount;
  type::u8	attr;
  type::u16	offset_high;
};

STRUCT(dtptr)
{
  type::u16         len;
  type::addr        addr;
};

CLASS(IntInitService)
{
 public:
  IntInitService(){}
  int                      gdt_size       (){return GDT_SIZE;}
  int                      idt_size       (){return IDT_SIZE;}
  void                     init           ();
 private:
  void                     init_interrupt ();
  descriptor::value        gdt[GDT_SIZE]; 
  gate::value              idt[IDT_SIZE];
  dtptr::value             gdtr;
  dtptr::value             idtr;
};

#endif
